<template>
  <div>
    <el-row>
      <el-col>
        <el-table
          :data="tableData2"
          style="width: 100%"
          border>
          <el-table-column
            prop="date"
            align="center"
            label="提交日期">
          </el-table-column>
          <el-table-column
            prop="name"
            align="center"
            label="姓名">
          </el-table-column>
          <el-table-column
            prop="name"
            align="center"
            label="所在班级">
          </el-table-column>
          <el-table-column
            prop="name"
            align="center"
            label="专业">
          </el-table-column>
          <el-table-column
            prop="province"
            align="center"
            label="分数">
          </el-table-column>
          <el-table-column
            prop="city"
            align="center"
            label="批阅日期">
          </el-table-column>
          <el-table-column
            prop="address"
            align="center"
            label="批阅人">
          </el-table-column>
          <el-table-column
            align="center"
            label="操作">
            <template slot-scope="scope">
              <el-button @click="handleClick(scope.row)" type="text" size="small">作业内容</el-button>
              <el-button @click="dialogFormVisible2 = true" type="text" size="small">上传作业</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          background
          style="margin-top: 10px;text-align: right"
          layout="prev, pager, next"
          :total="1000">
        </el-pagination>
      </el-col>
    </el-row>
    <el-dialog title="作业内容" :visible.sync="dialogFormVisible" width="40%">
      <el-form :model="form">
        <el-form-item label="名称" :label-width="formLabelWidth">
          <el-input v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="截止日期" :label-width="formLabelWidth">
          <el-col>
            <el-date-picker type="date" placeholder="选择日期" v-model="form.date1" style="width: 100%;"></el-date-picker>
          </el-col>
        </el-form-item>
        <el-form-item label="附件" :label-width="formLabelWidth">
          <el-upload
            class="upload-demo"
            drag
            action="https://jsonplaceholder.typicode.com/posts/"
            multiple>
            <i class="el-icon-upload"></i>
            <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
            <!--<div class="el-upload__tip" slot="tip">只能上传jpg/png文件，且不超过500kb</div>-->
          </el-upload>
        </el-form-item>
        <el-form-item label="作业描述" :label-width="formLabelWidth">
          <el-input type="textarea" v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="备注" :label-width="formLabelWidth">
          <el-input type="textarea" v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog title="上传" :visible.sync="dialogFormVisible2" width="40%">
      <el-form :model="form">
        <el-form-item label="附件" :label-width="formLabelWidth">
          <el-upload
            class="upload-demo"
            drag
            action="https://jsonplaceholder.typicode.com/posts/"
            multiple>
            <i class="el-icon-upload"></i>
            <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
            <!--<div class="el-upload__tip" slot="tip">只能上传jpg/png文件，且不超过500kb</div>-->
          </el-upload>
        </el-form-item>
        <el-form-item label="备注" :label-width="formLabelWidth">
          <el-input type="textarea" v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible2 = false">取 消</el-button>
        <el-button @click="dialogFormVisible2 = false">确定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    name: "studentsUpload",
    data() {
      return {
        dialogFormVisible2: false,
        tableData: [{
          date: '2016-05-02',
          name: '王小虎',
          province: '陕西',
          city: '计算机科学与应用',
          address: '陕西省西安市',
          zip: 200333
        }, {
          date: '2016-05-04',
          name: '王小虎',
          province: '陕西',
          city: '计算机科学与应用',
          address: '陕西省西安市',
          zip: 200333
        }, {
          date: '2016-05-01',
          name: '王小虎',
          province: '陕西',
          city: '计算机科学与应用',
          address: '陕西省西安市',
          zip: 200333
        }, {
          date: '2016-05-03',
          name: '王小虎',
          province: '陕西',
          city: '计算机科学与应用',
          address: '陕西省西安市',
          zip: 200333
        }],
        tableData2: [{
          date: '2016-05-02',
          name: '王小虎',
          province: '88',
          city: '2016-05-03',
          address: '王老师',
          zip: 200333
        }],
        dialogFormVisible: false,
        form: {
          name: '',
          region: '',
          date1: '',
          date2: '',
          delivery: false,
          type: [],
          resource: '',
          desc: ''
        },
        formLabelWidth: '120px'
      }
    },
    methods: {
      handleClick(row) {
        console.log(row);
        this.dialogFormVisible = true
      }
    },
  }
</script>

<style scoped>

</style>
